This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 5, 2012, 8:43 AM
2 Posts

Getting page element values

  • Category: Server Side JavaScript
  • Platform: All
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 3
 Hi, guys, 
 
I need some advise... I am a PHP developer started developing on XPages. 
 
I've got my first project - Survey Manager. The Idea is to create and get results from a few types of surveys - normal opinion survey, exam test, etc.
 
I've configured the Surveys as documents. The sections as survey responses. The questions within a section as section responses. And the available choices as question responses... So far, so good... 
 
I have displayed a list of the surveys, each linking to a voting page for the corresponding survey. On the voting page I have displayed the Survey details, the sections, questions, and choices in repeat controls. Each question can be multi-choice or single choice. Based on a question property I am hiding either the check-boxes, or the radio-buttons inside... 
 
Now I need to store the results, where my problems start... I can't find a way to get the answers store automatically in new documents, as each question has different number and type of choices with different text, so I can't create a form to display and use SaveAll - if you think I can, please give me a hint how to do it...
 
I tried to parse the xPage and get the values, but I don't know how to address the individual repeat control repeated content :( For eample I have the SectionsRepeat - which I address easily, because I know it's name. But I don't know how to address the repeated data, for example QuestionsRepeat - which is repeated for each section... I tried to use sectionsRepeat.getChildren() but it returns only one result instead of 6 - the number of sections inside the test survey...
 
Please give me a hint what my approach should be and what to try... 
Apr 5, 2012, 9:00 AM
56 Posts
Re: Getting page element values
Hi,
 
I don't know if I get the structure of your application correctly, but using so many response documents for one survey form sounds like you are making it harder than you should for yourself.
 
Useally, you could define one survey-form with multiple fields, which will contain the data entered by the user. If you have some different surveys, you could either define one form for each type of survey (the easiest way, but more work for you) or you put in all fields from all surveys into one form.
 
Then, based on a flag which indicates the type of the survey, you can compute whether to display or not specific fields. You can define Checkbox groups and rediobutton groups, for which you can compute the choices given to the user. You bind all controls to one datasource and then save this datasource. Then you should have all information in one document, which you can access via a datasource or whatever you like.
 
Also, you can build up a dynamic module system with Custom Controls. There you can put the varieties of input possibilities for each type of survey, based on computed visibility attributes based on the flag for your survey type.
 
But in general, I don't think you have to work with so many response documents, better put those into one form.
 
Hope this helps. If you have further problems or I haven't got your real problem, please ask.
 
 
mnicklisch.wordpress.com
Apr 5, 2012, 11:51 AM
2 Posts
Re: Getting page element values
 Hi,  Matthias
 
Thank you for the fast reply. My problem to choose this structure is because I don't know what will be the survey structure in terms of section count, questions per section - they can be different for every section, as well as choices per question - again different number for each question... How can I define this in a single form? 
 
Sorry if this is a stupid question, but as I said, I am new in Xpages and Lotus Notes in General... 
Apr 5, 2012, 2:12 PM
56 Posts
Re: Getting page element values
Imagine your form as a kind of pool for your surveys.
 
You can define your questions in configuration documents, there you also can define the possible answers and the right answer of the question. Simply a document with 3 fields, Question, Answers in Key=value pairs and a flag for the correct answer. In this documents you can define some more flags and configurations for each questions. Based on that, you can define another configuration with a mapping which questions will be displayed for each kind of survey. The rest is some computing in your XPage, where you define which fields will be displayed or which custom control is chosen. You do not even need to put a field for each question in your form, you coudl write everything in a RichText field and parse that if you want to access the data. That's the nice thing in Notes, there are always a lot of ways to implement something. With the documents you are free to model you data. You even do not have to define a form or a field in your form. You can put these information right into a document. But this is not recommended for maintenance reasons. But everything is possible,

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal